| Einhugur Word Plugin for Xojo |
|
EinhugurWord.Document Class
Class that represents docx Word document.
This class can Create, Read, Write and Edit Word documents.
EinhugurWord.Container
Document
class EinhugurWord.Document
Constructors
Properties
CreatedDate | Creation date of the document. (Meta data) |
Creator | Creator of the document. (Meta data) |
DefaultSection | Returns default section for the document. (Default page setup for the document) |
Description | Document description. (Meta data) |
DocumentDefaults | Gets the document defaults object. |
ItemCount (Inherited) | Number of items in the container. |
KeyWords | Keywords for the document. (Meta data) |
LastModifiedBy | Name of person to last modify the document. (Meta data) |
ModifiedDate | Last modification date of the document. (Meta data) |
ParagraphCount (Inherited) | Returns number of paragraphs in the container. |
Revision | Document revision. (Meta data) |
Subject | Document subject. (Meta data) |
TableCount (Inherited) | Returns number of tables in the container. |
Title | Document title. (Meta data) |
Methods
AddNewCharacterStyle | Adds new character style to the document. |
AddNewParagraphStyle | Adds new paragraph style to the document. |
AddNewTabletyle | Adds new table style to the document. |
AppendPageBreak | Appends page break at back of the document. |
AppendParagraph (Inherited) | Appends paragraph at back of the container, creating one run for the string passed in with this method. |
AppendParagraph (Inherited) | Appends paragraph at back of the container, creating one run for the image data passed in with this method. (This variation of the AppendParagraph is to embed images). |
AppendSectionBreak | Appends section break with a given rule. |
AppendTable (Inherited) | Appends table to the back of the container. |
ApplyFieldData | Applies filed data document wide. This covers paragraphs, tables, nested tables, nested paragraphs. |
CharacterStyles | Returns array of all predefined CharacterStyles in the document. |
shared Create | Creates new document at given location. |
CreateListIndent | Creates ListIndent object to be used with group of paragraphs. |
Footer | Gets footer of requested type from the document, optionally creating new footer if footer with the requested type does not exist. |
GetBookmarks | Gets all bookmarks in the document. |
Header | Gets header of requested type from the document, optionally creating new header if header with the requested type does not exist. |
Item (Inherited) | Returns item at given index. (Paragraphs or tables) |
Items (Inherited) | Returns DocumentItemIterator for the items in the container. This property is for using with for each statements. |
shared Open | Opens word document. |
Paragraph (Inherited) | Gets paragraph at given index. |
ParagraphStyles | Returns array of all predefined ParagraphStyles in the document. |
Paragraphs (Inherited) | Returns ParagraphIterator for the paragraphs in the container. This property is for using with for each statements. |
RemoveBookmark | Removes bookmark from the document. |
RemoveItem (Inherited) | Removes item from the container. |
Save | Saves the document. |
SaveAs | Saves the document with new name and or path. |
Table (Inherited) | Gets table at given index. |
TableStyles | Returns array of all predefined TableStyles in the document. |
Tables (Inherited) | Returns TableIterator for the tables in the container. This property is for using with for each statements. |
Examples
This example creates a simple hello world Word document:
using EinhugurWord
var ft as FileType = new FileType
ft.Extensions = "docx"
ft.Name = "Word Document"
var f as FolderItem = FolderItem.ShowSaveFileDialog(ft, "New document.docx")
if f <> nil then
try
var doc as Document = Document.Create(f)
doc.Creator = "Einhugur test user"
doc.LastModifiedBy = "Einhugur test user"
doc.Subject = "My first"
call doc.Paragraph(0).AppendRun("Hello world ! This is my first paragraph")
var p as Paragraph = doc.AppendParagraph("My second paragraph.")
p.Run(0).Bold = BooleanAttribute.YES
var r as Run = p.AppendRun(" And we can do styles.")
r.Italic = BooleanAttribute.YES
call doc.AppendParagraph("Check next page to see table we created")
doc.AppendPageBreak()
p = doc.AppendParagraph("Our paragraph on the 2nd page")
p.Run(0).TextColor = &c800000
var t as Table = doc.AppendTable(3,2)
var row as TableRow = t.Row(0)
call row.Cell(0).Paragraph(0).AppendRun("Data in table cell")
call row.Cell(1).Paragraph(0).AppendRun("1")
call row.Cell(2).Paragraph(0).AppendRun("2 !")
doc.Save()
catch e as WordException
MessageBox e.Message
end try
end if
Supported Platforms:
macOS Intel 64 bitmacOS Apple SiliconWindows 32 bitWindows 64 bitWindows ARM 64 bitLinux 32 bitLinux 64 bitLinux ARM 32 bitLinux ARM 64 bitiOS